package cn.tedu.admin.companyandjob.controller;

import cn.tedu.admin.companyandjob.pojo.param.CompanyParam;
import cn.tedu.admin.companyandjob.pojo.vo.CompanyListItemVO;
import cn.tedu.admin.companyandjob.service.ICompanyService;
import cn.tedu.common.pojo.vo.PageData;
import cn.tedu.common.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/companies")
@Api(tags = "公司管理模块")
public class CompanyController {
    @Autowired
    ICompanyService iCompanyService;

    @GetMapping("/list")
    @ApiOperation("查询公司列表功能")
    public JsonResult list(Integer pageNum){
        PageData<CompanyListItemVO> list = iCompanyService.list(pageNum);
        return JsonResult.ok(list);
    }

    @PostMapping("/updata/company")
    @ApiOperation("修改公司信息功能")
    public JsonResult updateCompany(Long companyId,CompanyParam companyParam){
        iCompanyService.updataCompany(companyId,companyParam);
        return JsonResult.ok();
    }

    @PostMapping("/delete/company")
    @ApiOperation("删除公司信息功能")
    public JsonResult deleteCompany(Long companyId){
        iCompanyService.deleteCompany(companyId);
        return JsonResult.ok();
    }

}
